﻿CREATE TABLE [entity].[Address] (
    [AddressID]        INT           IDENTITY (1, 1) NOT NULL,
    [EntityID]         INT           NULL,
    [AddressTypeID]    INT           NULL,
    [StreetLine1]      VARCHAR (200) NULL,
    [StreetLine2]      VARCHAR (200) NULL,
    [City]             VARCHAR (50)  NULL,
    [State]            VARCHAR (50)  NULL,
    [Zip]              VARCHAR (50)  NULL,
    [PreferredAddress] BIT           NULL,
    [CreatedBy]        VARCHAR (50)  NULL,
    [CreatedDate]      DATETIME      NULL,
    [UpdatedBy]        VARCHAR (50)  NULL,
    [UpdatedDate]      DATETIME      NULL,
    [EndDate]          DATETIME      NULL,
    CONSTRAINT [PK_Address] PRIMARY KEY CLUSTERED ([AddressID] ASC),
    CONSTRAINT [FK_Address_AddressType] FOREIGN KEY ([AddressTypeID]) REFERENCES [entity].[AddressType] ([AddressTypeID]),
    CONSTRAINT [FK_Address_Entity] FOREIGN KEY ([EntityID]) REFERENCES [entity].[Entity] ([EntityID])
);

